home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGMISC
/
FORTRAN1.LZH
/
GETXY.FOR
< prev
next >
Wrap
Text File
|
1988-02-08
|
3KB
|
122 lines
SUBROUTINE GETXY (NWRITE, IX, IY)
C*
C* *******************************
C* *******************************
C* ** **
C* ** GETXY **
C* ** **
C* *******************************
C* *******************************
C*
C* SUBPROGRAM :
C* GET X,Y LOCATION
C*
C* AUTHOR :
C* ART RAGOSTA
C* MS 207-5
C* AMES RESEARCH CENTER
C* MOFFETT FIELD, CALIF 94035
C* (415)694-5578
C*
C* PURPOSE :
C* TO RETRIEVE THE X AND Y LOCATION OF THE CURSOR.
C*
C* METHODOLOGY :
C* USE VT-100 CONTROL SEQUENCE.
C*
C* INPUT ARGUMENTS :
C* NWRITE - THE FORTRAN LOGICAL UNIT NUMBER ASSIGNED TO THE SCREEN.
C*
C* OUTPUT ARGUMENTS :
C* IX - THE COLUMN IN WHICH THE CURSOR RESIDES.
C* IY - THE ROW IN WHICH THE CURSOR RESIDES.
C* NOTE : (1,1) IS THE UPPER, LEFT-HAND CORNER OF THE SCREEN.
C*
C* INTERNAL WORK AREAS :
C* NONE
C*
C* COMMON BLOCKS :
C* NONE
C*
C* FILE REFERENCES :
C* NREAD, NWRITE
C*
C* DATA BASE ACCESS :
C* NONE
C*
C* SUBPROGRAM REFERENCES :
C* NONE
C*
C* ERROR PROCESSING :
C* IF THE TERMINAL DOES NOT MAKE AN INTELLIGIBLE RESPONSE TO THE
C* QUERY, IX AND IY ARE SET TO ZERO; THIS MAY HAPPEN WHEN A USER
C* TRIES TO USE THESE ROUTINES ON A NON-VT100 TYPE TERMINAL.
C*
C* TRANSPORTABILITY LIMITATIONS :
C* WORKS ONLY ON VT-100 OR COMPATIBLE TERMINALS.
C* USES THE NON-STANDARD $ FORMAT DESCRIPTIOR.
C*
C* ASSUMPTIONS AND RESTRICTIONS :
C* THE TERMINAL MUST BE ASSIGNED TO 'SYS$INPUT'.
C*
C* LANGUAGE AND COMPILER :
C* ANSI FORTRAN 77
C*
C* VERSION AND DATE :
C* VERSION I.0 30-JAN-85
C*
C* CHANGE HISTORY :
C* 30-JAN-85 INITIAL VERSION
C*
C***********************************************************************
C*
BYTE INBUFF(10)
CHARACTER *10 STRING
CHARACTER *1 ESC
DATA ESC/27/
DATA IONIT/0/
SAVE IONIT
EQUIVALENCE (INBUFF(1),STRING)
DATA NBUFF/10/
C
IX = 0
IY = 0
IF ( IONIT .EQ. 0 ) THEN
IONIT = 1
CALL IOINIT
ENDIF
C
C --- QUERY TERMINAL
C
WRITE ( NWRITE, 900 ) ESC
C
C --- DO ASYNCHRONOUS READ OF TERMINAL'S RESPONSE
C
C --- THE FOLLOWING READ IS REQUIRED BECAUSE VMS CONSIDERS AN ESCAPE AS AN
C --- END-OF-LINE CHARACTER
C
READ ( 5, 910 ) STRING
CALL INCHAR ( INBUFF, NBUFF, .FALSE., 1, NC, IERR )
IF ((IERR .EQ. -1) .OR. (IERR .EQ. -3)) RETURN
C
C --- DECODE THE TERMINAL RESPONSE ( <ESC>[ix;iyR )
C
I = INDEX ( STRING, '[' ) + 1
J = INDEX(STRING,';') - 1
IF (J .LT. I) RETURN
READ ( STRING(I:J), 920 ) IY
I = J + 2
J = INDEX(STRING,'R') - 1
IF (J .LT. I) RETURN
READ (STRING(I:J),920) IX
IF ((IX .LE. 0) .OR. (IX .GE. 133)) IX = 1
IF ((IY .LE. 1) .OR. (IY .GE. 25)) IY = 2
RETURN
900 FORMAT ('+',A1,'[6n',$ )
910 FORMAT ( A10 )
920 FORMAT ( I<J-I+1> )
END
C
C---END GETXY
C